<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>微信支付样例-支付</title>

<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/DDMBase.js"></script>

<link rel="stylesheet" href="${path }/resource/weixin/css/login.css">

</head>

<body>

	<button onclick="getMsg()">获取支付信息</button>
	<p id="msg"></p>
	<br />
	<font color="#9ACD32"><b>该笔订单支付金额为<span
			style="color: #f00; font-size: 50px">1分</span>钱
	</b></font>
	<br />
	<br />
	<div align="center">
		<button type="button" onclick="callpay()">立即支付</button>
	</div>
	<script type="text/javascript">
		//调用微信JS api 支付
		function jsApiCall() {
			WeixinJSBridge.invoke('getBrandWCPayRequest', {
				"appId" : "gh_8b42c50bbbcc", // 公众号名称，由商户传入
				"timeStamp" : " 1395712654", // 时间戳，自1970年以来的秒数
				"nonceStr" : "e61463f8efa94090b1f366cccfbbb444", // 随机串
				"package" : "prepay_id=u802345jgfjsdfgsdg888",
				"signType" : "MD5", // 微信签名方式:
				"paySign" : "70EA570631E4BB79628FBCA90534C63FF7FADD89" // 微信签名
			}, function(res) {
				if (res.err_msg == "get_brand_wcpay_request:ok") {
					alert("payOk");
				}
				// 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回 ok，但并不保证它绝对可靠。
			});
		}

		function callpay() {
			if (typeof WeixinJSBridge == "undefined") {
				if (document.addEventListener) {
					document.addEventListener('WeixinJSBridgeReady', jsApiCall,
							false);
				} else if (document.attachEvent) {
					document.attachEvent('WeixinJSBridgeReady', jsApiCall);
					document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
				}
			} else {
				jsApiCall();
			}
		}
		
		function getMsg() {
			
			MTools.redirect("${path}/customer/goodsPay/createTradeByWXBrowse");
				
		}
	</script>
</body>
</html>


</body>
</html>